package com.cos.emp.rjz9emp.web.controller;

import com.cos.emp.rjz9emp.entity.Emp;
import com.cos.emp.rjz9emp.services.EmpServices;
import com.cos.emp.rjz9emp.vo.EmpVo;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @author: COS
 * @time: 2021/12/24 11:25
 * @description:
 */
@Controller
@RequestMapping("/emp")
public class EmpController {
    @Autowired
    private EmpServices es;

    @RequestMapping("/getAll")
    @ResponseBody
    public List<Emp> getAll(){
        return es.getAll();
    }

    @RequestMapping("/getEmpByPage")
    @ResponseBody
    public PageInfo<Emp> getEmpByPage(@RequestParam("num") Integer pageNum, Double startSalary, Double endSalary, String ename){
        PageInfo<Emp> info=es.getEmpByPage(pageNum,startSalary,endSalary,ename);
        return info;
    }

}
